package com.zj.recyclerviewdemo.adapter;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zj.recyclerviewdemo.fragment.Main2Fragment;

/**
 * Created by Lenovo on 2017/4/28.
 */

public class Main3Adapter extends FragmentPagerAdapter {

    private static final String[] Tabs = {"left", "middle", "right"};

    public Main3Adapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        Main2Fragment main2Fragment = new Main2Fragment();

        Bundle bundle = new Bundle();
        bundle.putString("status", Tabs[position]);
        main2Fragment.setArguments(bundle);

        return main2Fragment;
    }

    @Override
    public int getCount() {
        return Tabs.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
//        return super.getPageTitle(position);
        return Tabs[position];
    }
}
